<template>
    <div class="circleA_loading_box">
        <div :style="circleAStyle"></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
    </div>
</template>

<script>
import {onMounted, ref} from 'vue'
export default {
    name: 'CircleLoadingA',
    setup() {
        let angle = ref(0) //圆圈起始角度
        let circleAStyle = ref('background-image: conic-gradient(from 0deg, rgba(0, 228, 0, 0.849), rgba(0, 228, 0, 0));')

        onMounted(()=>{
            circleARotate(false)
        })

        function circleARotate(stop) {
            if(stop) return
            if(angle.value >= 360) {
                angle.value = 0
            }
            angle.value += 7
            circleAStyle.value = `background-image: conic-gradient(from ${angle.value}deg, 
            rgba(0, 228, 0, 0.849), rgba(0, 228, 0, 0.3));`
            requestAnimationFrame(circleARotate.bind(this, false))
        }

        return {
            circleAStyle
        }
    }
}
</script>

<style scoped lang="css">
.circleA_loading_box {
    position: relative;
    top: 150px;
    left: 50%;
    width: 60px;
    height: 60px;
    transform: translateX(-50%);
}
.circleA_loading_box div {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}
.circleA_loading_box div:first-child {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}
.circleA_loading_box div:nth-child(2) {
    width: 75%;
    height: 75%;
    border-radius: 50%;
    background-color: rgba(229, 255, 82, 0.3);
    animation: divAnimation1 0.5s ease 0s infinite alternate;
}
@keyframes divAnimation1 {
    100%{
        background-color: rgba(229, 255, 82, 0.6);
    }
}
.circleA_loading_box div:nth-child(3) {
    top: 25%;
    left: 60%;
    width: 10%;
    height: 10%;
    border-radius: 50%;
    opacity: 0;
    background-color: rgba(255, 0, 0, 0.5);
    animation: divAnimation3 0.5s ease 0s infinite alternate;
}
.circleA_loading_box div:nth-child(4) {
    top: 16%;
    left: 35%;
    width: 10%;
    height: 10%;
    border-radius: 50%;
    opacity: 0;
    background-color: rgba(255, 0, 0, 0.5);
    animation: divAnimation3 0.5s ease 0s infinite alternate;
}
@keyframes divAnimation3 {
    100%{
        opacity: 1;
    }
}
.circleA_loading_box div:last-child {
    width: 40%;
    height: 40%;
    border-radius: 50%;
    background-color: rgba(102, 255, 0, 0.3);
    animation: divAnimation2 0.5s ease 0s infinite alternate;
}
@keyframes divAnimation2 {
    100%{
        background-color: rgba(102, 255, 0, 0);
    }
}
</style>